package com.sui.bigdata.flink.sql.function.util;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.feidee.fdcommon.configuration.CustomConfiguration;

import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Utils {
    public static Pattern p = Pattern.compile("^[-\\+]?[\\d]*$");

    public static boolean isMobileNO(String mobiles) {
        if (mobiles != null) {
            Matcher m = p.matcher(mobiles);
            return m.matches();
        }
        return false;
    }

    public static void main(String[] args) {
        Map<String, Object> JsonMap = null;

        JSONArray json= JSONArray.parseArray("[{\"name\":\"小米直播助手\",\"packName\":\"com.mi.liveassistant\",\"version\":\"4.53.1\"},{\"name\":\"美团\",\"packName\":\"com.sankuai.meituan\",\"version\":\"9.13.401\"},{\"name\":\"随手记\",\"packName\":\"com.mymoney\",\"version\":\"12.2.0.0\"},{\"name\":\"置优机\",\"packName\":\"com.dongguanzyj.zyj\",\"version\":\"1.0.6\"},{\"name\":\"利通钱包\",\"packName\":\"com.lxxwl.app\",\"version\":\"1.0.1\"},{\"name\":\"百度输入法小米版\",\"packName\":\"com.baidu.input_mi\",\"version\":\"8.2.4.40\"},{\"name\":\"微信\",\"packName\":\"com.tencent.mm\",\"version\":\"7.0.3\"},{\"name\":\"小爱语音引擎\",\"packName\":\"com.xiaomi.mibrain.speech\",\"version\":\"1.1.4\"},{\"name\":\"语音识别设置\",\"packName\":\"com.baidu.duersdk.opensdk\",\"version\":\"1.0.23\"},{\"name\":\"迅雷\",\"packName\":\"com.xunlei.downloadprovider\",\"version\":\"5.72.2.5920\"},{\"name\":\"应用宝\",\"packName\":\"com.tencent.android.qqdownloader\",\"version\":\"7.3.3\"},{\"name\":\"QQ同步助手\",\"packName\":\"com.tencent.qqpim\",\"version\":\"6.9.10\"},{\"name\":\"来借钱\",\"packName\":\"com.palmtoploan\",\"version\":\"3.6.5\"},{\"name\":\"小米画报\",\"packName\":\"com.mfashiongallery.emag\",\"version\":\"M919031230-MA\"},{\"name\":\"借亦有道\",\"packName\":\"com.jieyiyoudao.app\",\"version\":\"0.0.41\"},{\"name\":\"金盈花\",\"packName\":\"com.xsd.xsd\",\"version\":\"2.1.0\"},{\"name\":\"卡农社区\",\"packName\":\"com.appbyme.app177150\",\"version\":\"10333\"},{\"name\":\"开店宝\",\"packName\":\"com.epay.impay.ui.kaidianbao\",\"version\":\"3.7.8\"},{\"name\":\"招财猫\",\"packName\":\"com.tangchaoke.fortunecat\",\"version\":\"1.0\"},{\"name\":\"众安保险\",\"packName\":\"com.zhongan.insurance\",\"version\":\"3.1.8\"},{\"name\":\"UC浏览器\",\"packName\":\"com.UCMobile\",\"version\":\"12.3.6.1016\"},{\"name\":\"麻花影视\",\"packName\":\"com.amahua.ywofnbfd\",\"version\":\"2.6.1\"},{\"name\":\"抖音短视频\",\"packName\":\"com.ss.android.ugc.aweme\",\"version\":\"5.5.0\"},{\"name\":\"QQ\",\"packName\":\"com.tencent.mobileqq\",\"version\":\"7.9.9\"},{\"name\":\"小牛钱包\",\"packName\":\"com.xnapi.laidui\",\"version\":\"1.0.4\"},{\"name\":\"小花旅行\",\"packName\":\"com.whzxjr.xhlx\",\"version\":\"2.1.7\"},{\"name\":\"众人帮\",\"packName\":\"com.jianzhiku.zhongrenbang\",\"version\":\"3.66\"},{\"name\":\"云闪付\",\"packName\":\"com.unionpay\",\"version\":\"6.2.2\"},{\"name\":\"中国建设银行\",\"packName\":\"com.chinamworld.main\",\"version\":\"4.1.4\"},{\"name\":\"八方借款\",\"packName\":\"com.susuhua.bfjk\",\"version\":\"1.0.1\"},{\"name\":\"随意钱包\",\"packName\":\"com.suiyiqianbaox.app\",\"version\":\"1.0.11\"},{\"name\":\"阅读\",\"packName\":\"com.duokan.reader\",\"version\":\"5.8.6\"},{\"name\":\"聚鑫贷\",\"packName\":\"com.zh.jxd\",\"version\":\"0.0.30\"},{\"name\":\"财雨宝\",\"packName\":\"com.mahua.tad.caiyubao\",\"version\":\"1.0.0\"},{\"name\":\"唯品钱包\",\"packName\":\"com.fenmi.sunhui.weipinqianbao\",\"version\":\"1.0\"},{\"name\":\"小米金服安全组件\",\"packName\":\"com.xiaomi.jr.security\",\"version\":\"2.0.4\"},{\"name\":\"相册冲印组件\",\"packName\":\"com.mimoprint.xiaomi\",\"version\":\"2.3.2\"},{\"name\":\"手机淘宝\",\"packName\":\"com.taobao.taobao\",\"version\":\"8.5.10\"},{\"name\":\"全球上网工具插件\",\"packName\":\"com.xiaomi.mimobile.noti\",\"version\":\"1.4.3\"},{\"name\":\"唱吧\",\"packName\":\"com.changba\",\"version\":\"8.9.9\"},{\"name\":\"支付宝\",\"packName\":\"com.eg.android.AlipayGphone\",\"version\":\"10.1.59.231\"}]");
        for(int i=0;i<json.size();i++){
            //3、把里面的对象转化为JSONObject
            JSONObject job = json.getJSONObject(i);
            // 4、把里面想要的参数一个个用.属性名的方式获取到
            System.out.println(job.get("name")) ;
        }

    }
}
